<script>
    //ES5定义类
    //形状
    // function Shape(color){
    //     this.color=color;
    // }
    // Shape.prototype.show=function(){
    //     console.log("形状的颜色是："+this.color);
    // }
    // let shape=new Shape("蓝色");
    // shape.show();
    // console.log(shape instanceof Shape);

    //ES6定义类
    //形状
    //console.log(Shape);  //Cannot access 'Shape' before initialization
    class Shape{   //语法糖
        constructor(color){  //构造函数，new时调用
            this.color=color;
        }
        show(){
            console.log('形状的颜色是：'+this.color);
        }
    }
    let shape=new Shape("红色");
    shape.show();
    console.log(shape instanceof Shape);
    console.log(typeof Shape);
    console.dir(shape);
    console.log(Shape.prototype.show===shape.show);

    console.dir(Shape);
</script>